package com.jiyun.controller;

import com.jiyun.feign.MlFeign;
import com.jiyun.vo.ResultResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title: MlController
 * @Author 杜瑞
 * @Date 2023/8/25 21:02
 */
@RestController
@RequestMapping("ml")
public class MlController {
    @Autowired
    private MlFeign mlFeign;

    @RequestMapping("findAll")
    public ResultResponse findAll(String id){
        try {
            ResultResponse resultResponse = mlFeign.find1(id);
            return ResultResponse.success(resultResponse);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultResponse.error();
        }
    }

    @RequestMapping("toStudy")
    public ResultResponse toStudy(Long id){
        try {
            ResultResponse resultResponse = mlFeign.toStudy(id);
            return ResultResponse.success(resultResponse);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultResponse.error();
        }
    }
}
